<?php
session_start();
ob_start('ob_gzhandler');
include 'config.php';

if(@$_GET['danhmuc'] and @$_GET['detail']){
	$dt = $_GET['detail'];
	$danhmuc = $_GET['danhmuc'];
	$menu_one = $tc->menu_one($danhmuc);
	$row_menu_one = mysql_fetch_array($menu_one);
	switch($row_menu_one['type_id']){
		case 2 : include_once('blocks/articles_detail.php'); ($row_detail['url_hinh']!='') ? $image='http://'.$domain.'/'.url_articles_thumb_image.$row_detail['url_hinh'] : $image=url_default_image; break;
		case 3 : include_once('blocks/photo_detail.php'); break;
		case 5 : include_once('blocks/cohoi_nghenghiep.php'); break;
		case 6 : include_once('blocks/video_detail.php'); break;
		default : $view_post = 'Không có loại bạn muốn tìm';
	}
	$url = 'http://'.$domain.'/'.$row_menu_one['url'].$row_detail['name_rewrite'].'.html';
	$seo = $tc->seo($domain,$row_detail['name'],$row_detail['description'].$row_detail['metaDescription'],$row_detail['metaKeyword'],$image,$url);
	$slogan = "<h5>{$row_config['slogan']}</h5>";
}elseif(@$_GET['danhmuc']){
	$dm = $_GET['danhmuc'];
	$dm = explode('/',$dm);
	$danhmuc = $dm[0];
	if($dm[1]=='') $page = 1;
	else{
		$page = $dm[1];
		$trang = ' - Trang '.$page;
	}
	$menu_one = $tc->menu_one($danhmuc);
	$row_menu_one = mysql_fetch_array($menu_one);
	($row_menu_one['url_hinh']=='') ? $image=url_default_image : $image=url_danhmuc_image.$row_menu_one['url_hinh'];
	$url = 'http://'.$domain.'/'.$row_menu_one['url'];
	$seo = $tc->seo($domain,$row_menu_one['title'].$trang,$row_menu_one['metaDescription'].$trang,$row_menu_one['metaKeyword'],$image,$url);
	$slogan = "<h5>{$row_config['slogan']}</h5>";
	switch($row_menu_one['type_id']){
		case 2 : include_once('blocks/articles_list.php'); break;
		case 3 : include_once('blocks/photo_list.php'); break;
		case 5 : include_once('blocks/cohoi_nghenghiep.php'); break;
		case 6 : include_once('blocks/video_list.php'); break;
		case 7 : include_once('blocks/contact.php'); break;
		default : $view_post = 'Không có loại bạn muốn tìm';
	}
}else{
	if(!@$_GET['p']){
		$menu_one = $tc->menu_one('trang-chu');
		$row_menu_one = mysql_fetch_array($menu_one);
		$image='http://'.$domain.'/'.url_default_image;
		$url = 'http://'.$domain.'/'.$row_menu_one['url'];
		$seo = $tc->seo($domain,$row_menu_one['title'],$row_menu_one['metaDescription'],$row_menu_one['metaKeyword'],$image,$url);
		$slogan = "<h1>{$row_config['slogan']}</h1>";
		include_once('blocks/home.php');
	}else{
		$id = $_GET['id'];
		$menu_one = $tc->menu_one('trang-chu');
		$row_menu_one = mysql_fetch_array($menu_one);
		$image='http://'.$domain.'/'.url_default_image;
		$url = 'http://'.$domain.$_SERVER['REQUEST_URI'];
		$seo = $tc->seo($domain,'Đăng ký trực tuyến '.$id.' - '.$row_menu_one['title'],'Đăng ký trực tuyến '.$id.' - '.$row_menu_one['metaDescription'],'Đăng ký trực tuyến '.$id.','.$row_menu_one['metaKeyword'],$image,$url);
		$slogan = "<h1>{$row_config['slogan']}</h1>";
		include_once('blocks/dangkytructuyen.php');
	}
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $seo; ?>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="assets/wt-rotator.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="library/jquery.js"></script>
<script type="text/javascript" src="assets/jquery.wt-rotator.min.js"></script>
<script type="text/javascript" src="assets/preview.js"></script>
<script type="text/javascript" src="library/jquery.corner.js"></script>
</head>
<body>
<div id="wrapper">
	<?php
	include_once('blocks/header.php');
	include_once('blocks/left.php');
	echo '<div id="content">'.$view_post.'<div><div id="footer">'.$row_config['contact'].'</div></div> </div>';
	include_once('blocks/right.php');
	echo '';
	?>
    <div id="support">
        <div style="float:left">Điện thoại: <b>(08) 3517 1167 - (08) 3517 1169</b> &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; </div>
        <div style="float:left">Tư vấn trực tuyến: &nbsp; </div>
        <div style="float:left"><a href="ymsgr:sendIM?dt_dienvien"><img align='left' src='http://opi.yahoo.com/online?u=dt_dienvien&m=g&t=0' border=0> &nbsp;<b>Ms. Trân</b></a>&nbsp;-&nbsp;</div>
        <div style="float:left"><a href="ymsgr:sendIM?dt_dienvien2"><img align='left' src='http://opi.yahoo.com/online?u=dt_dienvien2&m=g&t=0' border=0> &nbsp;<b>Ms. Trân</b></a></div>
    </div>
</div>
</body>
</html>